package com.example.controller;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller // 将对象存储到 Spring 中，标识为控制层组件
public class UserController {
    @Autowired // 直接在字段上使用@Autowired
    private UserService userService;
    public void hello() {
        System.out.println("hi,UserController...");
    }
}